﻿using BCEntity.OA.BusinessTypeRecord;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace BCData.OA.BusinessTypeRecord
{
    /// <summary>
    /// OA业务类型
    /// </summary>
    public interface IBusinessTypeRecordData
    {
        /// <summary>
        /// 获取所有业务类型列表
        /// </summary>
        /// <returns></returns>
        Task<IEnumerable<BusinessTypeRecordEntity>> GetAllAsync();

        /// <summary>
        /// 获取指定的业务类型
        /// </summary>
        /// <param name="typeName">业务类型名称</param>
        /// <param name="sobSettingId">账套Id</param>
        /// <returns></returns>
        Task<BusinessTypeRecordEntity> GetEntityByTypeNameAndSobSettingIdAsync(string typeName, long sobSettingId);
        /// <summary>
        /// 分页获取OA业务类型记录(列表)
        /// </summary>
        /// <param name="typeName">类型名称</param>
        /// <param name="start">创建时间开始</param>
        /// <param name="end">创建时间结束</param>
        /// <param name="ascending">是否升序排序</param>
        /// <param name="pageIndex">分页页码</param>
        /// <param name="pageSize">分页页数</param>
        /// <returns></returns>
        Task<(IEnumerable<BusinessTypeRecordEntity>, int)> GetListAsync(string typeName, DateTime? start, DateTime? end, bool? ascending, int pageIndex, int pageSize);

        /// <summary>
        /// 新增OA业务类型
        /// </summary>
        /// <param name="entity">业务类型信息</param>
        /// <returns></returns>
        Task<BusinessTypeRecordEntity> InsertAsync(BusinessTypeRecordEntity entity);

        /// <summary>
        /// 修改OA业务类型
        /// </summary>
        /// <param name="entity">业务类型信息</param>
        /// <returns></returns>
        Task<BusinessTypeRecordEntity> UpdateAsync(BusinessTypeRecordEntity entity);

        /// <summary>
        /// 校验是否已存在
        /// </summary>
        /// <param name="typeName"></param>
        /// <param name="sobSettingId"></param>
        /// <returns></returns>
        bool CheckIsExists(string typeName, long sobSettingId);

        /// <summary>
        /// 校验是否已存在
        /// </summary>
        /// <param name="businessTypeRecordId"></param>
        /// <returns></returns>
        bool CheckIsExists(long businessTypeRecordId);
    }
}
